#pragma once

#include "d3d9.h"
#include "d3dx9.h"
#include <stdio.h>
#include <sstream>
#include <string>

// Add pragma comments so we do not have to change
//  the project dependencies
#pragma comment (lib, "d3d9.lib")
#pragma comment (lib, "d3dx9.lib")
#pragma comment(lib, "winmm.lib")

// FMOD library and includes (sound middleware)
#include "fmod.h"
#include "fmod.hpp"
#include "fmod_codec.h"
#include "fmod_dsp.h"
#include "fmod_errors.h"
#include "fmod_memoryinfo.h"
#include "fmod_output.h"
#pragma comment(lib, "fmodex_vc.lib")
// End FMOD library and includes

class Sound
{
private:

	// Singleton instance
	static Sound*	m_SoundInstance;

	// Set up the FMOD sound middleware references
	FMOD::System	*system;
	FMOD_RESULT		fModResult;

	// Channels
	FMOD::Channel	*channel;

	// Game Music
	FMOD::Sound		*menuScreenMusic;
	FMOD::Sound		*miniGameMusic;
	FMOD::Sound		*levelMusic[10 + 1];

	// Collision Sound Effects
	FMOD::Sound		*collAcidPit;
	FMOD::Sound		*collMaterialOrb;
	FMOD::Sound		*collFireWall;
	FMOD::Sound		*collTeslaCoil;
	FMOD::Sound		*collPiston;
	FMOD::Sound		*collCircuitWall;
	FMOD::Sound		*collJumpPad;

	// Input Sound Effects
	FMOD::Sound		*menuBtnClick;
	FMOD::Sound		*pickFourBtnClk;
	FMOD::Sound		*slideEightPceSlct;
	FMOD::Sound		*trackPlcCrt;
	FMOD::Sound		*trackPlcIncrt;
	FMOD::Sound		*trackPlcCan;
	FMOD::Sound		*trackSelected;
	FMOD::Sound		*trackRotate;
	FMOD::Sound		*cameraShift;
	FMOD::Sound		*undoBtnClk;

	//Miscellaneous Sound Effects
	FMOD::Sound		*voiceIntro;

	// End FMOD sound middleware references

public:
	// constructor
	Sound(void);

	// destructor
	~Sound(void);

	// Singleton functions
	static Sound* GetSoundInstance(void);
	void DeleteInstance(void);

	// Initialize all the sounds
	void InitSounds(void);

	// Sound methods
	void Update();

	// Music methods
	void MenuScreenMusic();
	void MiniGameMusic();
	void LevelMusic(int iCurrLevel);

	// Collision SFX methods
	void AcidPitCollisionSFX();
	void FireWallCollisionSFX();
	void TeslaCoilCollisionSFX();
	void MaterialOrbCollisionSFX();
	void PistonCollisionSFX();
	void CircuitWallCollisionSFX();
	void JumpPadCollisionSFX();

	// Input SFX methods
	void MenuButtonClickSFX();
	void PickFourButtonClickSFX();
	void TrackSelectedSFX();
	void TrackPlacedCorrectSFX();
	void TrackPlacedIncorrectSFX();
	void TrackPlaceCancel();
	void TrackRotateSFX();
	void CameraShiftSFX();
	void UndoButtonClickSFX();
	void SlideEightPieceSelectSFX();

	//Miscellaneous SFX methods
	void IntroVoiceSFX();
};
